#ifndef _GUI_PROGRAMTABLEDELEGATE_H
#define _GUI_PROGRAMTABLEDELEGATE_H

#include <QItemDelegate>

class SysController;

class ProgramTableDelegate : public QItemDelegate {
	Q_OBJECT

public:
	ProgramTableDelegate(QObject *parent = 0);

	QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, 
						  const QModelIndex &index) const;
	void setEditorData(QWidget *editor, const QModelIndex &index) const;
	void setModelData(QWidget *editor, QAbstractItemModel *model,
					  const QModelIndex &index) const;

signals:
	void itemEditingFinished(int item_index) const;

private:
//	enum ItemRows {
//		kItemRowNameSuffixCh = 0,
//		kItemRowBias,
//		kItemRowWaitTime,
//		kItemRowMeas,
//		kItemRowFilter,
//		kItemRowVolLimit,
//		kItemRowLimitJudge,
//		kItemRowCount
//	};

	void AdjustEditorStyle(QWidget *widget) const;

	enum ItemRow {
		kItemRowNameSuffixCh = 0,
		kItemRowBiasRng,
		kItemRowBiasVal,
		kItemRowWaitTime,
		kItemRowMeasRng,
		kItemRowMeasValLower,
		kItemRowMeasValUpper,
		kItemRowFilter,
		kItemRowVolLimit,
		kItemRowLimitJudge,
		kItemRowCount
	};

	SysController *sys_;
};

#endif // _GUI_PROGRAMTABLEDELEGATE_H
